<template>
	<view class="container">
		<!-- <navbar :config="config" backColor="#fff"></navbar> -->
		<navbar :config="config" ref="navbar" backColor="#000"></navbar>
		<view class="bg-fff u-mt20 u-p30" v-if="keystatus == 1">
			<view class="goodsItem  u-flex-center mb20" v-for="(value, index) in list" :key="value.id">
				<image :src="value.goods_cover" v-if="value.goods_cover" class="u-goods200 u-ml15" mode=""></image>
				<image :src="value.goods_img" v-if="value.goods_img" class="u-goods200 u-ml15" mode=""></image>
				<view class="u-flex1 u-flex-column-start rightText u-ml30">
					<view class="u-display1 u-474747 u-font32">{{ value.goods_title }}</view>
					<view class="bottext u-flex-column-start u-flex1">
						<text class="u-font26 u-AAAAAA u-mt10" v-if="value.sku_set_name">规格：
							{{ value.sku_set_name }}</text>
						<view class="u-flex-center botPrice u-mt30">
							<view class="u-FF721B u-font32 " v-if="value.exchange">{{ value.exchange_point }} 积分
							</view>
							<view class="u-FF721B u-font32 " v-else>
								<rich-text :nodes="$mUtil.priceBigSmall(value.sale_price)"></rich-text>
							</view>
							<text class="u-font26 u-AAAAAA u-ml15" v-if="value.num">x {{ value.num }}</text>
							<text class="u-font26 u-AAAAAA u-ml15" v-if="value.number">x {{ value.number }}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="bg-fff u-mt20 u-p30" v-if="keystatus == 2 || keystatus == 3">
			<view class="goodsItem  u-flex-center">
				<image :src="value.goods_cover" v-if="value.goods_cover" class="u-goods200 u-ml15" mode=""></image>
				<image :src="value.goods_img" v-if="value.goods_img" class="u-goods200 u-ml15" mode=""></image>
				<view class="u-flex1 u-flex-column-start rightText u-ml30">
					<view class="u-display1 u-474747 u-font32">{{ value.goods_title }}</view>
					<view class="bottext u-flex-column-start u-flex1">
						<text class="u-font26 u-AAAAAA u-mt10" v-if="value.sku_set_name">规格：
							{{ value.sku_set_name }}</text>
						<view class="u-flex-center botPrice u-mt30">
							<view class="u-FF721B u-font32 " v-if="value.exchange">{{ value.exchange_point }} 积分
							</view>
							<view class="u-FF721B u-font32 " v-else>
								<rich-text :nodes="$mUtil.priceBigSmall(value.sale_price)"></rich-text>
							</view>
							<text class="u-font26 u-FF721B u-ml15" v-if="value.num">x {{ value.num }}</text>
							<text class="u-font26 u-FF721B u-ml15" v-if="value.number">x {{ value.number }}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- u-bg-fff -->
		<view class="u-mt20">
			<view class="u-plr40">
				<picker @change="pickerChange($event, 'industry')" :value="applicationTypeIndex" range-key="name"
					:range="applicationTypeList" v-if="applicationTypeList.length > 0">
					<view class="u-flex-center-sb u-border-one-one ht104">
						<view class="u-474747">售后类型</view>
						<view class="u-flex">
							<view class="uni-input ml38 u-4D4D4D">{{ applicationTypeList[applicationTypeIndex].name }}
							</view>
							<view class="iconfont u-474747">&#xe6c7;</view>
						</view>
					</view>
				</picker>
				<picker @change="pickerChangeres($event, 'industry')" :value="applicationIndex" range-key="name"
					:range="applicationList" v-if="applicationList.length > 0">
					<view class="u-flex-center-sb u-border-one-one ht104">
						<view class="u-474747">售后原因</view>
						<view class="u-flex">
							<view class="uni-input ml38 u-4D4D4D">{{ applicationList[applicationIndex].name }}</view>
							<view class="iconfont u-474747">&#xe6c7;</view>
						</view>
					</view>
				</picker>
				<view class="u-flex-center-sb u-border-one-one ht104" v-if="keystatus == 2">
					<view class="u-474747">数量</view>
					<view class="rightAddRes u-flex-center">
						<text class="minus" @click="resNum">-</text>
						<text class="num centertext u-font28 u-999">{{ num }}</text>
						<text class="plus-sign" @click="addNum">+</text>
					</view>
				</view>
				<view class="u-flex-center-sb u-border-one-one ht104">
					<view class="u-474747">退款金额</view>
					<!-- <view class="u-FF0000 u-font32 u-bold"><rich-text :nodes="$mUtil.priceBigSmall(12.2)" ></rich-text></view> -->
					<input type="digit" :value="money" maxlength="10" @input="onchangeInput"
						class=" u-font32  u-flex1 u-text-right" style="color:#FF211F"/>
				</view>
				<view class="u-flex-center-sb u-border-one-one ht104" v-if="able_refund_point > 0">
					<view class="u-474747">退款积分</view>
					<view class=" u-font32 " style="color:#FF211F">{{ able_refund_point }}</view>
				</view>
			</view>
		</view>

		<!-- u-bg-fff -->
		<view class="u-plr40 apply">
			<view class="u-474747">退款备注</view>
			<view class="u-mt25"><textarea placeholder="请您详细填写申请说明" @input="onchangeText" maxlength="45"></textarea>
			</view>
			<view class="u-mt30 u-474747">上传凭证</view>
			<view class="u-mt25">
				<uploadImg imgCount="3" url="" :type="upimgtype" @result="resultUrl" @delImg="delImg"></uploadImg>
			</view>
      <view class="u-mt25" v-if="this.third&&this.third_trade_type_id!=3">
        <view class="u-mt30 u-474747">快递面单照</view>
        <uploadImg imgCount="3" url="" :type="upimgtype" @result="resultUrl_express_img" @delImg="delImg_express_img"></uploadImg>
      </view>
      <view class="u-mt25" v-if="this.third&&this.third_trade_type_id!=3">
        <view class="u-mt30 u-474747">快递外箱照片</view>
        <uploadImg imgCount="3" url="" :type="upimgtype" @result="resultUrl_package_img" @delImg="delImg_package_img"></uploadImg>
      </view>
      <view class="u-mt25" v-if="this.third&&this.third_trade_type_id!=3">
        <view class="u-mt30 u-474747">商品正面照</view>
        <uploadImg imgCount="3" url="" :type="upimgtype" @result="resultUrl_product_img" @delImg="delImg_product_img"></uploadImg>
      </view>
      <view class="u-mt25" v-if="this.third&&this.third_trade_type_id!=3">
        <view class="u-mt30 u-474747">破损处特写照片</view>
        <uploadImg imgCount="3" url="" :type="upimgtype" @result="resultUrl_defect_product_img" @delImg="delImg_defect_product_img"></uploadImg>
      </view>
      <view class="u-mt25" v-if="this.third&&this.third_trade_type_id!=3">
        <view class="u-mt30 u-474747">商品效期照片</view>
        <uploadImg imgCount="3" url="" :type="upimgtype" @result="resultUrl_product_shelf_life_img" @delImg="delImg_product_shelf_life_img"></uploadImg>
      </view>
		</view>

		<view class="btn" @click="submitApply"><button class="u-btn-two">提交审核</button></view>
	</view>
</template>

<script>
	import uploadImg from '../../../components/uploadImg/imgUpload.vue';
	import uniPopup from '../../../components/uni-popup/uni-popup.vue';
	export default {
		components: {
			uploadImg,
			uniPopup
		},
		data() {
			return {
				upimgtype: 'rights',
				config: {
					back: true, //false是tolbar页面 是则不写
					title: '申请退款',
					color: '#000',
					//背景颜色;参数一：透明度（0-1）;参数二：背景颜色（array则为线性渐变，string为单色背景）
					backgroundColor: [1, "#fff"],
					statusBarFontColor: '#1A1A1A',
					backIconColor: "#000",
				},
				applicationTypeIndex: 0,
				applicationIndex: 0,
				applicationTypeList: [], //申请类型

        // 售后原因列表
				applicationList: [],

				imgArray: [], //图片列表
				value: {},
				keystatus: 1, //1：未发货，退款(无子订单)，2：收到货退款/退货(有子订单)，并且需要处理子订单，3非退款退货的售后类型(有子订单)
				parent_order_id: null,
				order_id: null,
				list: [],
				money: 0,
				moneyold: 0,
				num: 0,
				number: 0,
				flag: true,
				reason: '多拍、错拍、不想要',
        reason_code: 1,
				caption: '',
				able_refund_point: 0,
				type: null,
				third: false,
				verifyList: [],
				third_service_type: 0,
				third_package_type_code: 0,
        third_trade_type_id: null, // 贸易类型id，1=保税直供，2=完税进口，3=国内贸易，4=香港直邮，5=海外直邮
        third_post_type: null, //售后类型 1退款，2申请补偿，3退货退款，4换货，5补发
        third_refund_reason_id: 0, //售后原因id 通过售后原因接口获取
        third_express_img_array: null, //快递面单照 售后类型 为1时选填 其他类型必填
        third_package_img_array: null, //快递外箱照片 售后类型 为1时选填 其他类型必填
        third_product_img_array: null, //商品正面照 售后类型 为1时选填 其他类型必填
        third_defect_product_img_array: null, //破损处特写照片 售后类型 为1时选填 其他类型必填
        third_product_shelf_life_img_array: null, //商品效期照片 售后类型 为1时选填 其他类型必填
			};
		},
		onLoad(option) {
      if (option.third == 'true') {
        this.third = option.third == 'true' ? true : false
		
        // this.verify()
      }

      let goodslist = uni.getStorageSync('blackgoodsList')
      if(this.third) { // 如果是第三方订单

        // 获取候鸟的售后原因列表
        // 第三方售后原因列表：
        // 1   ,不想要该商品了
        // 2   ,重复订单
        // 3   ,拍错了
        // 4   ,破损拒收
        // 5   ,无理由拒收
        // 6   ,快递一直未收到
        // 7   ,空包裹
        // 8   ,发错商品
        // 9   ,商品漏液（不影响使用）
        // 10  ,商品包装破损（不影响使用）
        // 11  ,商品外观瑕疵（不影响使用）
        // 12  ,商品破损
        // 13  ,商品漏液
        // 14  ,质量问题
        // 15  ,商品外观瑕疵
        // 16  ,奶粉发错效期
        // 17  ,奶粉发错段数
        // 18  ,奶粉瘪罐
        // 19  ,奶粉爆罐
        // 20  ,无理由退货
        this.applicationList = [];
        this.$http.get('/rights/third/afterSaleSeasons', {})
          .then(res => {
            if (res && res.code === 200) {
              for (let item of res.data) {
                this.applicationList.push({code: item.id, name: item.reason_title})
              }
            } else {
              this.$mUtil.toast('无法从第三方系统获取到可以使用的售后原因列表，请重新打开页面。' + res.data.msg );
            }
          });

        // 获取第三方商品的贸易类型
        if(goodslist && goodslist.length > 0) {
          this.$http.get('/goods/info/' + goodslist[0].goods_id, {})
            .then(res => {
              if (res && res.code === 200) {
                this.third_trade_type_id = res.data.trade_type_id
				
              } else {
                this.$mUtil.toast('无法从第三方系统获取到商品信息，请重新打开页面。' + res.data.msg);
              }
            });
        }

        // 设置第三方的售后类型列表
        if (option.keystatus === 1) {  // 退款
          this.applicationTypeList = [{
            i: 1,
            name: '退款'
          }];
        } else if (option.keystatus === 2) {  // 退货退款
          this.applicationTypeList = [{
            i: 3,
            name: '退货退款'
          }];
        } else  {  // 其他售后类型
          this.applicationTypeList = [{
            i: 1,
            name: '退款'
          }/*, {
            i: 2,
            name: '申请补偿'
          }*/, {
            i: 3,
            name: '退货退款'
          }, {
            i: 4,
            name: '换货'
          }, {
            i: 5,
            name: '补发'
          }];
        }
      } else {  // 自营
        this.applicationList = [{
          code: 1,
          name: '多拍、错拍、不想要'
        }, {
          code: 1,
          name: '不喜欢、效果不好'
        }, {
          code: 1,
          name: '商品成分描述不符'
        }, {
          code: 1,
          name: '其他'
        }];

        if (option.keystatus === 2) {  // 退货退款
          this.applicationTypeList = [{
            i: 0,
            name: '退款'
          }, {
            i: 1,
            name: '退货'
          }];
        } else if (option.keystatus === 1) {  // 退款
          this.applicationTypeList = [{
            i: 0,
            name: '退款'
          }];
        }
      }

			if (option.title) {
				this.config.title = option.title;
			}
			if (option.id) {
				this.order_id = option.id;
			}
			if (option.orderid) {
				this.parent_order_id = option.orderid;
			}
			if (option.type) {
				this.type = option.type;
			}

			if (this.keystatus) {
				this.keystatus = option.keystatus;
				if (option.keystatus == 2 || option.keystatus == 3) {
					//子订单
					if (goodslist) {
						goodslist.forEach(item => {
							if (item.id == option.id) {
								this.value = item;
								this.childOrder(option.orderid, option.id, item.number);
								this.addNumber(option.orderid, option.id, item.number);
							}
						});
					}
          if (option.keystatus === 2) {  // 退货退款
            this.reason = this.applicationList[this.applicationIndex].name;
            this.reason_code = this.applicationList[this.applicationIndex].code;
          }
				} else {
					//主订单
					if (goodslist) {
						this.list = goodslist;
					}
					this.mainOrder(option.orderid);
          this.reason = this.applicationList[this.applicationIndex].name;
          this.reason_code = this.applicationList[this.applicationIndex].code;
				}
			}
		},

		methods: {
			onchangeText(e) {
				if (e) {
					this.caption = e.detail.value;
				}
				e;
			},
			onchangeInput(e) {
				if (e) {
					this.money = e.detail.value;
				}
			},

			resultUrl(e) {
				this.imgArray = e;
			},
			delImg(e) {
				this.imgArray = e;
			},

      resultUrl_express_img(e) {
        this.third_express_img_array = e;
      },
      delImg_express_img(e) {
        this.third_express_img_array = e;
      },

      resultUrl_package_img(e) {
        this.third_package_img_array = e;
      },
      delImg_package_img(e) {
        this.third_package_img_array = e;
      },

      resultUrl_product_img(e) {
        this.third_product_img_array = e;
      },
      delImg_product_img(e) {
        this.third_product_img_array = e;
      },

      resultUrl_defect_product_img(e) {
        this.third_defect_product_img_array = e;
      },
      delImg_defect_product_img(e) {
        this.third_defect_product_img_array = e;
      },

      resultUrl_product_shelf_life_img(e) {
        this.third_product_shelf_life_img_array = e;
      },
      delImg_product_shelf_life_img(e) {
        this.third_product_shelf_life_img_array = e;
      },

			submitApply() {
				let that = this;
				if (!that.caption) {
					that.$mUtil.toast('请填写退款备注');
					return false;
				}
				if (this.imgArray.length == 0) {
					this.$mUtil.toast('请填上传凭证')
					return false
				}
				if (that.money * 1 > that.moneyold * 1) {
					that.$mUtil.toast('退款金额不能大于' + that.moneyold);
					return false;
				}

        // 包裹在正常时效内派送，产品也无破损问题，则不支持退货退款
        // 贸易类型id，1=保税直供，2=完税进口，3=国内贸易，4=香港直邮，5=海外直邮
        // 第三方售后原因列表：
        // 1   ,不想要该商品了
        // 2   ,重复订单
        // 3   ,拍错了
        // 4   ,破损拒收
        // 5   ,无理由拒收
        // 6   ,快递一直未收到
        // 7   ,空包裹
        // 8   ,发错商品
        // 9   ,商品漏液（不影响使用）
        // 10  ,商品包装破损（不影响使用）
        // 11  ,商品外观瑕疵（不影响使用）
        // 12  ,商品破损
        // 13  ,商品漏液
        // 14  ,质量问题
        // 15  ,商品外观瑕疵
        // 16  ,奶粉发错效期
        // 17  ,奶粉发错段数
        // 18  ,奶粉瘪罐
        // 19  ,奶粉爆罐
        // 20  ,无理由退货
        if(that.third&&that.third_trade_type_id!=3){ // 第三方订单并且需要根据子订单处理退货退款
          if (typeof that.third_trade_type_id === 'undefined') {
            this.$mUtil.toast('未从第三方系统获取到商品信息，请重新打开页面。');
            return false;
          }

          if (that.reason_code !== 1 && (!that.third_express_img_array || that.third_express_img_array.length === 0)) {
            this.$mUtil.toast('请填上传快递面单照。请注意：此订单是第三方订单，并且售后类型选择了非退款类型，则第三方系统要求必须上传快递面单照、外箱照片、正面照、破损处特写照片、效期照片。')
            return false
          }

          if (that.reason_code !== 1 && (!that.third_package_img_array || that.third_package_img_array.length === 0)) {
            this.$mUtil.toast('请填上传外箱照片。请注意：此订单是第三方订单，并且售后类型选择了非退款类型，则第三方系统要求必须上传快递面单照、外箱照片、正面照、破损处特写照片、效期照片。')
            return false
          }

          if (that.reason_code !== 1 && (!that.third_product_img_array || that.third_product_img_array.length === 0)) {
            this.$mUtil.toast('请填上传正面照。请注意：此订单是第三方订单，并且售后类型选择了非退款类型，则第三方系统要求必须上传快递面单照、外箱照片、正面照、破损处特写照片、效期照片。')
            return false
          }

          if (that.reason_code !== 1 && (!that.third_defect_product_img_array || that.third_defect_product_img_array.length === 0)) {
            this.$mUtil.toast('请填上传破损处特写照片。请注意：此订单是第三方订单，并且售后类型选择了非退款类型，则第三方系统要求必须上传快递面单照、外箱照片、正面照、破损处特写照片、效期照片。')
            return false
          }

          if (that.reason_code !== 1 && (!that.third_product_shelf_life_img_array || that.third_product_shelf_life_img_array.length === 0)) {
            this.$mUtil.toast('请填上传效期照片。请注意：此订单是第三方订单，并且售后类型选择了非退款类型，则第三方系统要求必须上传快递面单照、外箱照片、正面照、破损处特写照片、效期照片。')
            return false
          }

          if(that.third_trade_type_id === 4 || that.third_trade_type_id === 5){
            if (that.reason_code === 1
            || that.reason_code === 2
            || that.reason_code === 3
            || that.reason_code === 5
            || that.reason_code === 9
            || that.reason_code === 10
            || that.reason_code === 11
            || that.reason_code === 18
            || that.reason_code === 20) {
              that.$mUtil.toast('对于香港直邮和海外直邮的商品，如果包裹在正常时效内派送，产品也无破损问题，则不支持退货退款');
              return false;
            }
          }
        }

				if (that.keystatus == 1) {

          let data = {
            order_id: that.parent_order_id,
            rights_cargo_status: 0, //0未收货，1已收货
            rights_type: 1, //1仅退款,2退款退货
            reason: that.reason,
            caption: that.caption,
            voucher_images: that.imgArray,
            refund_money: that.money,
            refund_point: that.able_refund_point
          };

          if (that.third) {
            data.third_service_type = that.third_service_type
            data.third_refund_reason_id = this.third_refund_reason_id
            data.third_package_type_code = 0
            data.third_post_type = that.third_post_type ? that.third_post_type.i : 1
            data.third_refund_description = that.reason
            data.third_addenda_img = that.imgArray
            data.third_express_img = that.third_express_img_array
            data.third_package_img = that.third_package_img_array
            data.third_product_img = that.third_product_img_array
            data.third_defect_product_img = that.third_defect_product_img_array
            data.third_product_shelf_life_img = that.third_product_shelf_life_img_array
          } else {
            data.third_post_type = 0
            data.third_addenda_img_array = []
            data.third_refund_reason_id = 0
          }

          that.$http.post('/rights/apply/order', data).then(res => {
            if (res && res.code == 200) {
              that.$mUtil.toast('申请成功');
              setTimeout(() => {
                uni.reLaunch({
                  url: '/pages/order/orderList/orderList?keys=6'
                });
              }, 1000);
            }
          });
				} else {
					let data = {
						order_id: that.parent_order_id,
						child_order_id: that.order_id,
						rights_cargo_status: 1, //0未收货，1已收货
						rights_type: that.applicationTypeIndex * 1 + 1, //1仅退款,2退款退货
						reason: that.reason,
						caption: that.caption,
						voucher_images: that.imgArray,
						refund_money: that.money,
						refund_num: that.num,
						refund_point: that.able_refund_point
					};

					if (that.third) {
						data.third_service_type = this.third_service_type
						if (data.third_service_type == '40') {
							data.rights_type = 1
						} else if (data.third_service_type == '50') {
							data.rights_type = 2
						}

            data.third_service_type = that.third_service_type
						data.third_refund_reason_id = that.third_refund_reason_id
						data.third_package_type_code = 0
            data.third_post_type = that.third_post_type ? that.third_post_type.i : 1
            data.third_refund_description = that.reason
            data.third_addenda_img = that.imgArray
            data.third_express_img = that.third_express_img_array
            data.third_package_img = that.third_package_img_array
            data.third_product_img = that.third_product_img_array
            data.third_defect_product_img = that.third_defect_product_img_array
            data.third_product_shelf_life_img = that.third_product_shelf_life_img_array
					} else {
						data.third_service_type = 0
						data.third_refund_reason_id = 0
						data.third_package_type_code = 0
					}

          that.$http.post('/rights/apply/child', data)
              .then(res => {
                if(!res){
                  that.$mUtil.toast('服务器返回数据格式错误');
                }
                else if (res.code == 200) {
                  that.$mUtil.toast('申请成功');
                  setTimeout(() => {
                    uni.reLaunch({
                      url: '/pages/order/orderList/orderList'
                    });
                  }, 1000);
                } else {
                  that.$mUtil.toast('服务器返回错误:' + JSON.stringify(res));
                }
              })
              .catch(err => {
                that.$mUtil.toast('服务器返回错误:' + JSON.stringify(err));
              });
        }
			},
			//减
			resNum() {
				if (this.num * 1 > 1) {
					this.flag = false;
					this.num--;
					this.addNumber(this.parent_order_id, this.order_id, this.num);
				}
			},
			//加
			addNum() {
				console.log(this.number);
				if (this.num < this.number) {
					this.flag = false;
					this.num++;
					this.addNumber(this.parent_order_id, this.order_id, this.num);
				}
			},
			//主订单可以最多可以退多少钱
			mainOrder(id) {
				let data = {
					order_id: id
				};
				this.$http.post('/rights/main/able-refund-money', data).then(res => {
					if (res && res.code == 200) {
						this.money = res.data.able_refund_money;
						this.moneyold = res.data.able_refund_money;
						this.able_refund_point = res.data.able_refund_point;
						// this.num = res.data.goods_num
						// this.number = res.data.goods_num
					}
				});
			},
			//子订单可以最多可以退多少钱
			childOrder(id, childid, num) {
				let data = {
					order_id: id,
					child_order_id: childid,
					refund_num: num
				};
				this.$http.post('/rights/child/able-refund-money', data).then(res => {
					if (res && res.code == 200) {
						this.money = res.data.able_refund_money;
						this.moneyold = res.data.able_refund_money;
						this.able_refund_point = res.data.able_refund_point;
						this.number = res.data.goods_num;
						if (this.flag) {
							this.num = res.data.goods_num;
						}
					}
				});
			},
			addNumber(id, childid, num) {
				let data = {
					order_id: id,
					child_order_id: childid,
					refund_num: num
				};
				this.$http.post('/rights/child/able-refund-money', data).then(res => {
					if (res && res.code == 200) {
						this.money = res.data.able_refund_money;
						this.moneyold = res.data.able_refund_money;
						this.able_refund_point = res.data.able_refund_point;

						if (this.flag) {
							this.num = res.data.goods_num;
						}
					}
				});
			},

			pickerChange(e, val) {
        console.log("e",e)
				this.applicationTypeIndex = e.target.value;
				if (this.third) {
					this.third_service_type = this.applicationTypeList[e.target.value].code
				}

        this.third_post_type = this.applicationTypeList[e.target.value]
			},
			pickerChangeres(e, val) {
				this.applicationIndex = e.target.value;
				this.reason = this.applicationList[e.target.value].name;
        this.reason_code = this.applicationList[e.target.value].code;
				if (this.third) {
					this.third_refund_reason_id = this.applicationList[e.target.value].code
				}
			},
			// 第三方售后前置校验
			verify() {
				this.$http.post('/rights/third/beforeCheck', {
					order_id: this.parent_order_id,
					child_order_id: this.order_id
				}).then(res => {
					if (res.code == 200 && res.data) {
						if (res.data.serviceType.length > 0) {
							this.verifyList = res.data.serviceType
							this.applicationTypeList = []
							this.applicationList = []
							this.applicationList = res.data.reasonsType
							for (let item of res.data.serviceType) {
								if (item.code == '40' || item.code == '50') {
									this.applicationTypeList.push(item);
								}
							}
							this.third_service_type = this.applicationTypeList[0].code
							this.third_refund_reason_id = this.applicationList[0].code
							this.reason = this.applicationList[0].name;
              this.reason_code = this.applicationList[0].code;
						}
					}
				}).catch(err => {})
			}
		}
	};
</script>

<style lang="scss">
	page {
		background-color: #fafafa;
	}

	.bg-fff {
		background-color: #fff;
	}

	.ml38 {
		margin-left: 38rpx;
	}

	.mb20 {
		margin-bottom: 20rpx;
	}

	.ht104 {
		height: 104rpx;
		line-height: 104rpx;
	}

	.rightAddRes {
		width: 172rpx;
		height: 50rpx;
		border-radius: 8rpx;
		border: 1px solid #e5e5e5;

		.centertext {
			text-align: center;
		}

		//减号
		.minus {
		  width: 50rpx;
		  height: 50rpx;
		  line-height: 50rpx;
		  text-align: center;
		  background: #dedede;
		  border-radius: 8rpx 0rpx 0rpx 8rpx;
		}
		
		.num {
		  width: 74rpx;
		  height: 50rpx;
		  line-height: 50rpx;
		  text-align: center;
		  border: 1px solid #dedede;
		}
		
		//加号
		.plus-sign {
		  width: 50rpx;
		  height: 50rpx;
		  line-height: 50rpx;
		  text-align: center;
		  background: #dedede;
		  border-radius: 0rpx 8rpx 8rpx 0rpx;
		}
	}

	.p-tlbr30 {
		padding: 30rpx;
	}

	textarea {
		width: 100%;
		height: 210rpx;
		opacity: 0.66;
		border: 1rpx solid #e6e6e6;
		border-radius: 8rpx;
		padding-left: 22rpx;
		padding-top: 14rpx;
		box-sizing: border-box;
	}

	.apply {
		padding-top: 34rpx;
		padding-bottom: 42rpx;
	}

	.btn {
		padding: 70rpx 30rpx;

		button {
			background: #FF211F;
			color: #ffffff;
		}
	}
	.container{
		background-color: #fff;
	}
	
</style>